//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package javax.vpncrypto.spec;

import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;

public class RC2ParameterSpec implements AlgorithmParameterSpec {
    private byte[] iv;
    private int effectiveKeyBits;

    public RC2ParameterSpec(int var1) {
        this.iv = null;
        this.effectiveKeyBits = var1;
    }

    public RC2ParameterSpec(int var1, byte[] var2) {
        this(var1, var2, 0);
    }

    public RC2ParameterSpec(int var1, byte[] var2, int var3) {
        this.iv = null;
        this.effectiveKeyBits = var1;
        if (var2 == null) {
            throw new IllegalArgumentException("IV missing");
        } else {
            byte var4 = 8;
            if (var2.length - var3 < var4) {
                throw new IllegalArgumentException("IV too short");
            } else {
                this.iv = new byte[var4];
                System.arraycopy(var2, var3, this.iv, 0, var4);
            }
        }
    }

    public int getEffectiveKeyBits() {
        return this.effectiveKeyBits;
    }

    public byte[] getIV() {
        return this.iv == null ? null : (byte[])this.iv.clone();
    }

    public boolean equals(Object var1) {
        if (var1 == this) {
            return true;
        } else if (!(var1 instanceof RC2ParameterSpec)) {
            return false;
        } else {
            RC2ParameterSpec var2 = (RC2ParameterSpec)var1;
            return this.effectiveKeyBits == var2.effectiveKeyBits && Arrays.equals(this.iv, var2.iv);
        }
    }

    public int hashCode() {
        int var1 = 0;
        if (this.iv != null) {
            for(int var2 = 1; var2 < this.iv.length; ++var2) {
                var1 += this.iv[var2] * var2;
            }
        }

        return var1 + this.effectiveKeyBits;
    }
}
